App.factory('prompt', ['ngDialog', function(ngDialog) {
	  
	return {
		
		openAlert: function(message) {

			var dialog = ngDialog.open({
		        template: '<h4>'+ message +'</h4>',
		        plain: true,
		        closeByDocument: false,
		        closeByEscape: false
		    });
		    setTimeout(function () {
		        dialog.close();
		    }, 2000);
	    },
	    
	    message: function(key){
	    	
	    	if(key){
	    		
	    		var message = messages[key];
	    		
	    		if(message){
	    			
	    			return message;
	    		}
	        }
	    	
	        return key;
	    }
	};
}]);